//医生认证--查询所有科室-层级
import type {
  GetDepAllData,
  GetPatientConsultOrderDetailData,
  GetPatientConsultOrderListData,
  GetPatientConsultOrderListParams,
  GetPatientConsultOrderPreData,
  GetPatientConsultOrderPreParams,
  PostPatientConsultOrderParams,
  PostPatientConsultPayParams,
} from '@/types/consult'
import { request } from '@/utils/request'

export const getDepAllAPI = () => request<GetDepAllData[]>('/dep/all', 'GET')

/**
 * 问诊-保存/修改问诊订单
 * @param data 问诊订单数据
 * @returns 问诊订单id
 */
export const postPatientConsultOrderAPI = (data: PostPatientConsultOrderParams) => {
  return request<{ id: string }>('/patient/consult/order', 'POST', data)
}

/**
 * 问诊-支付页面-计算就诊信息和抵扣信息
 * @param data 问诊订单数据
 * @returns 问诊订单数据
 */
export const getPatientConsultOrderPreAPI = (data: GetPatientConsultOrderPreParams) => {
  return request<GetPatientConsultOrderPreData>('/patient/consult/order/pre', 'GET', data)
}

//支付宝支付
export const postPatientConsultPayAPI=(data:PostPatientConsultPayParams)=>{
  return request<{payUrl:string}>('/patient/consult/pay','POST',data)
}

/**支付后获取订单详情
 * 问诊订单详情
 */
export const getPatientConsultOrderDetailAPI = (orderId: string) => {
  return request<GetPatientConsultOrderDetailData>('/patient/consult/order/detail', 'GET', { orderId: orderId } )
}


/**
 * 问诊记录-订单列表-找医生、极速问诊、开药问诊
 * @param params 参数
 * @returns 订单列表数据
 */
export const getPatientConsultOrderListAPI = (params: GetPatientConsultOrderListParams) => {
  return request<GetPatientConsultOrderListData>('/patient/consult/order/list', 'GET', params)
}